package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchSiteCurve;
import com.ruoyi.system.service.IDispatchSiteCurveService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 多站点曲线分析Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchSiteCurve")
public class DispatchSiteCurveController extends BaseController
{
    @Autowired
    private IDispatchSiteCurveService dispatchSiteCurveService;

    /**
     * 查询多站点曲线分析列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteCurve:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchSiteCurve dispatchSiteCurve)
    {
        startPage();
        List<DispatchSiteCurve> list = dispatchSiteCurveService.selectDispatchSiteCurveList(dispatchSiteCurve);
        return getDataTable(list);
    }

    /**
     * 导出多站点曲线分析列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteCurve:export')")
    @Log(title = "多站点曲线分析", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchSiteCurve dispatchSiteCurve)
    {
        List<DispatchSiteCurve> list = dispatchSiteCurveService.selectDispatchSiteCurveList(dispatchSiteCurve);
        ExcelUtil<DispatchSiteCurve> util = new ExcelUtil<DispatchSiteCurve>(DispatchSiteCurve.class);
        util.exportExcel(response, list, "多站点曲线分析数据");
    }

    /**
     * 获取多站点曲线分析详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteCurve:query')")
    @GetMapping(value = "/{siteCurveId}")
    public AjaxResult getInfo(@PathVariable("siteCurveId") Long siteCurveId)
    {
        return success(dispatchSiteCurveService.selectDispatchSiteCurveBySiteCurveId(siteCurveId));
    }

    /**
     * 新增多站点曲线分析
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteCurve:add')")
    @Log(title = "多站点曲线分析", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchSiteCurve dispatchSiteCurve)
    {
        return toAjax(dispatchSiteCurveService.insertDispatchSiteCurve(dispatchSiteCurve));
    }

    /**
     * 修改多站点曲线分析
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteCurve:edit')")
    @Log(title = "多站点曲线分析", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchSiteCurve dispatchSiteCurve)
    {
        return toAjax(dispatchSiteCurveService.updateDispatchSiteCurve(dispatchSiteCurve));
    }

    /**
     * 删除多站点曲线分析
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchSiteCurve:remove')")
    @Log(title = "多站点曲线分析", businessType = BusinessType.DELETE)
	@DeleteMapping("/{siteCurveIds}")
    public AjaxResult remove(@PathVariable Long[] siteCurveIds)
    {
        return toAjax(dispatchSiteCurveService.deleteDispatchSiteCurveBySiteCurveIds(siteCurveIds));
    }
}
